//
//  ViewController.swift
//  NetProject
//
//  Created by EDY on 2021/11/1.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        
        
        let view = UIView.snpView(supView: self.view, backColor: .orange, tapGesture: nil) { make in
            make.top.equalToSuperview().offset(200)
            make.left.equalToSuperview()
            make.width.equalToSuperview()
            make.height.equalTo(200)
        }
        let datePicker = DatePickerView.snpDatePickerView(supView: view, type: .pickerDateHourMinuteSecond, selectDate: Date(), minYear: Date().getYear(), maxYear: Date().getYear() + 5, showUnit: true) { make in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.width.equalToSuperview()
            make.height.equalToSuperview()
        } callBack: { date in
            let formatterDate = date.swe.stringWithFormat("YYYY-MM-dd HH:mm:ss")
            print("\(formatterDate)")
        }

//        let datePicker = DatePickerView.init( type: .pickerMonthDayHourMinute, selectDate: Date(), minYear: Date().getYear(), maxYear: Date().getYear() + 10, showUnit: true , callBack: { date in
//            let formatterDate = date.swe.stringWithFormat("YYYY-MM-dd HH:mm:ss")
//            print("\(formatterDate)")
//        })
//        view.addSubview(datePicker)

//        datePicker.snp.remakeConstraints { make in
//            make.top.equalToSuperview()
//            make.left.equalToSuperview()
//            make.width.equalToSuperview()
//            make.height.equalToSuperview()
//        }
        
        let stackView = UIStackView.snpStackView(supView: self.view, backColor: .orange, cornerRadius: 0, axis: .horizontal, spacing: 5, alignment: .center, distribution: .fill, autoLayout: false, snapKitMaker: { make in
            make.top.equalToSuperview().offset(200)
            make.width.equalToSuperview()
            make.height.equalTo(45)
            make.left.equalToSuperview()
            
        })
        
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 5) {
            stackView.snp.remakeConstraints { make in
                make.top.equalToSuperview()
                make.width.equalToSuperview()
                make.height.equalTo(45)
                make.left.equalToSuperview()
            }
        }
        
        
        
        
        let firstLabel = UILabel.snpLabel()
        firstLabel.textAlignment = .center
        firstLabel.text = "22222222222"
        
        let secondLabel = UILabel.snpLabel()
        secondLabel.textAlignment = .center
        secondLabel.text = "44444444444444444444444444444"
        
        let thirdLabel = UILabel.snpLabel()
        thirdLabel.textAlignment = .center
        thirdLabel.text = "66666666"
        
        let fourthLabel = UILabel.snpLabel()
        fourthLabel.textAlignment = .center
        fourthLabel.text = "0000000"
        
        stackView.addArrangedSubviews([firstLabel,secondLabel,thirdLabel,fourthLabel])
        
        
    }


}

